// const isProd = process.env.NODE_ENV === "production";
const isTest = process.env.TEST_ENV === "test";
// target: 'http://wfc2018-api.weddingee.com',

module.exports = {
  devServer: {
    proxy: {
      "/api": {
        target: "https://app-dashboard.weddingee.com",
        // target: "https://shan.weddingee.com",
        // target: "https://b.lichenglove.com",
        changeOrigin: true
      }
    }
  },
  pages: {
    index: "src/main.js"
  },
  productionSourceMap: false,
  publicPath: isTest ? "/h5/dashboard/" : "/",
  outputDir: "dist/dashboard",
  assetsDir: "static",
  // 文件名中的 hash
  filenameHashing: true,
  chainWebpack: config => {
    // 删除 webpack 插件
    config.plugins.delete("preload");
    config.plugins.delete("prefetch");
    // 超过10k自动打包成base64
    config.module
      .rule("images")
      .use("url-loader")
      .loader("url-loader")
      .tap(options => Object.assign(options, { limit: 10240 }));
  },
  css: {
    loaderOptions: {
      less: {
        globalVars: {
          "primary-color": "#1890ff"
        }
      }
    }
  }
};
